<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="format-detection" content="telephone=no"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><link rel="icon" href="/blog/blog/images/icons/favicon-16x16.png?v=2.6.2" type="image/png" sizes="16x16"><link rel="icon" href="/blog/blog/images/icons/favicon-32x32.png?v=2.6.2" type="image/png" sizes="32x32"><meta name="description" content=".back-top{position: fixed;top: 500px;height: 0px;float: right;right: 50px;} .back-top&gt;a{font-weight:bold;width: 50px;height: 50px;text-align: center;text-decoration: none;font-size: 5px;line-height:">
<meta property="og:type" content="article">
<meta property="og:title" content="C++管理系统">
<meta property="og:url" content="https://bruce-jj.gitee.io/blog/2021/03/19/C-%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/index.html">
<meta property="og:site_name" content="斯人若彩虹 遇上方知有">
<meta property="og:description" content=".back-top{position: fixed;top: 500px;height: 0px;float: right;right: 50px;} .back-top&gt;a{font-weight:bold;width: 50px;height: 50px;text-align: center;text-decoration: none;font-size: 5px;line-height:">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-03-19T06:45:08.000Z">
<meta property="article:modified_time" content="2021-03-25T01:30:16.000Z">
<meta property="article:author" content="何水浪">
<meta property="article:tag" content="编程语言">
<meta name="twitter:card" content="summary"><title>C++管理系统 | 斯人若彩虹 遇上方知有</title><link ref="canonical" href="https://bruce-jj.gitee.io/blog/2021/03/19/C-%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/"><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.12.1/css/all.min.css" type="text/css"><link rel="stylesheet" href="/blog/css/index.css?v=2.6.2"><script>var Stun = window.Stun || {};
var CONFIG = {
  root: '/blog/',
  algolia: undefined,
  assistSearch: undefined,
  fontIcon: {"prompt":{"success":"fas fa-check-circle","info":"fas fa-arrow-circle-right","warning":"fas fa-exclamation-circle","error":"fas fa-times-circle"},"copyBtn":"fas fa-copy"},
  sidebar: {"offsetTop":"20px","tocMaxDepth":6},
  header: {"enable":true,"showOnPost":true,"scrollDownIcon":false},
  postWidget: {"endText":true},
  nightMode: {"enable":true},
  back2top: {"enable":true},
  codeblock: {"style":"default","highlight":"light","wordWrap":false},
  reward: false,
  fancybox: false,
  zoomImage: {"gapAside":"20px"},
  galleryWaterfall: undefined,
  lazyload: false,
  pjax: undefined,
  externalLink: {"icon":{"enable":true,"name":"fas fa-external-link-alt"}},
  shortcuts: undefined,
  prompt: {"copyButton":"复制","copySuccess":"复制成功","copyError":"复制失败"},
  sourcePath: {"js":"js","css":"css","images":"images"},
};

window.CONFIG = CONFIG;</script><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/blog/atom.xml" title="斯人若彩虹 遇上方知有" type="application/atom+xml">
</head><body><div class="container" id="container"><header class="header" id="header"><div class="header-inner"><nav class="header-nav header-nav--fixed"><div class="header-nav-inner"><div class="header-nav-menubtn"><i class="fas fa-bars"></i></div><div class="header-nav-menu"><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/"><span class="header-nav-menu-item__icon"><i class="fas fa-home"></i></span><span class="header-nav-menu-item__text">首页</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/archives/"><span class="header-nav-menu-item__icon"><i class="fas fa-folder-open"></i></span><span class="header-nav-menu-item__text">归档</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/categories/"><span class="header-nav-menu-item__icon"><i class="fas fa-layer-group"></i></span><span class="header-nav-menu-item__text">分类</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/tags/"><span class="header-nav-menu-item__icon"><i class="fas fa-tags"></i></span><span class="header-nav-menu-item__text">标签</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/friends/"><span class="header-nav-menu-item__icon"><i class="fas fa-link"></i></span><span class="header-nav-menu-item__text">友链</span></a></div></div><div class="header-nav-search"><span class="header-nav-search__icon"><i class="fas fa-search"></i></span><span class="header-nav-search__text">搜索</span></div><div class="header-nav-mode"><div class="mode"><div class="mode-track"><span class="mode-track-moon"></span><span class="mode-track-sun"></span></div><div class="mode-thumb"></div></div></div></div></nav><div class="header-banner"><div class="header-banner-info"><div class="header-banner-info__title">斯人若彩虹 遇上方知有</div><div class="header-banner-info__subtitle"></div></div></div></div></header><main class="main" id="main"><div class="main-inner"><div class="content-wrap" id="content-wrap"><div class="content" id="content"><!-- Just used to judge whether it is an article page--><div id="is-post"></div><div class="post"><header class="post-header"><h1 class="post-title">C++管理系统</h1><div class="post-meta"><span class="post-meta-item post-meta-item--createtime"><span class="post-meta-item__icon"><i class="far fa-calendar-plus"></i></span><span class="post-meta-item__info">发表于</span><span class="post-meta-item__value">2021-03-19</span></span><span class="post-meta-item post-meta-item--updatetime"><span class="post-meta-item__icon"><i class="far fa-calendar-check"></i></span><span class="post-meta-item__info">更新于</span><span class="post-meta-item__value">2021-03-25</span></span><span class="post-meta-item post-meta-item--wordcount"><span class="post-meta-item__icon"><i class="far fa-file-word"></i></span><span class="post-meta-item__info">字数统计</span><span class="post-meta-item__value">1.9k</span></span><span class="post-meta-item post-meta-item--readtime"><span class="post-meta-item__icon"><i class="far fa-clock"></i></span><span class="post-meta-item__info">阅读时长</span><span class="post-meta-item__value">19分</span></span></div></header><div class="post-body"><!-- 页面必备样式 -->
<style>
.back-top{position: fixed;top: 500px;height: 0px;float: right;right: 50px;}
.back-top>a{font-weight:bold;width: 50px;height: 50px;text-align: center;text-decoration: none;font-size: 5px;line-height: 50px;border-radius: 50px;background-color:rgba(255,255,255,0.5);}
</style>
<div class="back-top">
    <a href="#top"> >返回顶部< </a>
</div>
<!-- toc -->
<!-- 必备样式结束 -->


        <h1 id="源代码"   >
          <a href="#源代码" class="heading-link"><i class="fas fa-link"></i></a><a href="#源代码" class="headerlink" title="源代码"></a>源代码</h1>
      <figure class="highlight cpp"><div class="table-container"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br><span class="line">338</span><br><span class="line">339</span><br><span class="line">340</span><br><span class="line">341</span><br><span class="line">342</span><br><span class="line">343</span><br><span class="line">344</span><br><span class="line">345</span><br><span class="line">346</span><br><span class="line">347</span><br><span class="line">348</span><br><span class="line">349</span><br><span class="line">350</span><br><span class="line">351</span><br><span class="line">352</span><br><span class="line">353</span><br><span class="line">354</span><br><span class="line">355</span><br><span class="line">356</span><br><span class="line">357</span><br><span class="line">358</span><br><span class="line">359</span><br><span class="line">360</span><br><span class="line">361</span><br><span class="line">362</span><br><span class="line">363</span><br><span class="line">364</span><br><span class="line">365</span><br><span class="line">366</span><br><span class="line">367</span><br><span class="line">368</span><br><span class="line">369</span><br><span class="line">370</span><br><span class="line">371</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string">&lt;stdio.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string">&lt;stdlib.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string">&lt;string&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string">&lt;cstring&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="keyword">typedef</span> <span class="class"><span class="keyword">struct</span> <span class="title">student</span>          //学生信息</span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line">    <span class="keyword">char</span> stu_num[<span class="number">15</span>];           <span class="comment">//学号</span></span><br><span class="line">    <span class="keyword">char</span> name[<span class="number">15</span>];              <span class="comment">//姓名</span></span><br><span class="line">    <span class="keyword">char</span> stu_id[<span class="number">20</span>];            <span class="comment">//身份证号</span></span><br><span class="line">    <span class="keyword">char</span> institute[<span class="number">50</span>];         <span class="comment">//学院</span></span><br><span class="line">    <span class="keyword">char</span> stu_type;              <span class="comment">//学生类型</span></span><br><span class="line">    <span class="keyword">char</span> major[<span class="number">50</span>];             <span class="comment">//专业</span></span><br><span class="line">    <span class="keyword">char</span> route[<span class="number">100</span>];            <span class="comment">//返校路线</span></span><br><span class="line">    <span class="keyword">char</span> TrafficTools[<span class="number">100</span>];     <span class="comment">//交通工具</span></span><br><span class="line">    <span class="keyword">char</span> isCloseContact;        <span class="comment">//近14天是否有密切接触确诊人员</span></span><br><span class="line">    <span class="keyword">char</span> temperature[<span class="number">10</span>];       <span class="comment">//入校时温度</span></span><br><span class="line">    <span class="keyword">char</span> isFever;               <span class="comment">//是否发烧</span></span><br><span class="line">    <span class="keyword">char</span> isCough;               <span class="comment">//是否咳嗽</span></span><br><span class="line">    <span class="keyword">char</span> time[<span class="number">20</span>];              <span class="comment">//进校时间</span></span><br><span class="line"> </span><br><span class="line">&#125;Student;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">Print</span><span class="params">(Student stu)</span>             <span class="comment">//输出学生信息</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;\n*****************学生信息*****************\n\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;学号: %s\n姓名: %s\n身份证号: %s\n学生类型: %c\n&quot;</span>,stu.stu_num,stu.name,stu.stu_id,stu.stu_type);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;学院: %s\n专业: %s\n返校路线: %s\n交通工具: %s\n&quot;</span>,stu.institute,stu.major,stu.route,stu.TrafficTools);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;过去14天是否密切接触确诊人员（是：1/否：0）： %c\n返校温度: %s\n&quot;</span>,stu.isCloseContact,stu.temperature);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;是否发烧（是：1/否：0）: %c\n是否咳嗽（是：1/否：0）: %c\n返校时间: %s\n&quot;</span>,stu.isFever,stu.isCough,stu.time);</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">Instruction</span><span class="params">()</span>                  <span class="comment">//帮助</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;====================学生返校信息管理系统====================\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                                                          =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                   ***功能介绍***                         =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                                                          =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                   1.录入学生信息                         =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                   2.查找学生信息                         =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                   3.修改学生信息                         =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                   4.按顺序输出某学院学生信息             =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                   5.请求帮助                             =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                   6.退出系统                             =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                                                          =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;=                                                          =\n&quot;</span>);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;============================================================\n&quot;</span>);</span><br><span class="line">    <span class="keyword">return</span> ;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">WriteStuInfo</span><span class="params">()</span></span>&#123;</span><br><span class="line">	FILE *fp;</span><br><span class="line">	<span class="keyword">char</span> c = <span class="string">&#x27;y&#x27;</span>;</span><br><span class="line">	<span class="keyword">char</span> file[<span class="number">50</span>] = <span class="string">&quot;C:\\Users\\Administrator\\Desktop\\&quot;</span>;</span><br><span class="line">	</span><br><span class="line">	<span class="keyword">while</span>(c == <span class="string">&#x27;y&#x27;</span>)&#123;</span><br><span class="line">		Student stu = &#123;<span class="number">0</span>&#125;; <span class="comment">//初始化</span></span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请按照以下内容初始化：\n&quot;</span>;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入学号\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.stu_num;</span><br><span class="line"></span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入姓名\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.name;</span><br><span class="line"></span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入身份证\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.stu_id;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;学生类型：（1本 2研 3博）\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.stu_type;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;所在学院\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.institute;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;所在专业\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.major;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;返校所经城市\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.route;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;交通工具\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.TrafficTools;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;是否接触确诊：1是 0否&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.isCloseContact;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;入校时的温度\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.temperature;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;是否发烧: 1是 0否\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.isFever;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;是否咳嗽: 1是 0否\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.isCough;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;入校时间\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.time;</span><br><span class="line">		</span><br><span class="line">		<span class="built_in">strcat</span>(file, stu.institute);</span><br><span class="line">		<span class="built_in">strcat</span>(file, <span class="string">&quot;.txt&quot;</span>);</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; file;</span><br><span class="line">		fp = <span class="built_in">fopen</span>(file, <span class="string">&quot;a&quot;</span>);</span><br><span class="line">		<span class="keyword">if</span>(fp == <span class="literal">NULL</span>)&#123;</span><br><span class="line">			cout &lt;&lt; <span class="string">&quot;文件无法打开\n&quot;</span>;</span><br><span class="line">			<span class="built_in">exit</span>(<span class="number">0</span>); </span><br><span class="line">		&#125;</span><br><span class="line">		</span><br><span class="line">		<span class="keyword">if</span>(<span class="built_in">fwrite</span>(&amp;stu, <span class="built_in"><span class="keyword">sizeof</span></span>(Student), <span class="number">1</span>, fp) != <span class="number">1</span>)&#123;</span><br><span class="line">			cout &lt;&lt;<span class="string">&quot;数据无法录入\n&quot;</span>;</span><br><span class="line">		&#125;</span><br><span class="line">		</span><br><span class="line">		<span class="comment">//在定义的数组长度不够的情况下 </span></span><br><span class="line">		<span class="comment">//每次读入一组数据 可以在文件中打印一个换行符</span></span><br><span class="line">		<span class="comment">//fprintf(fp, &quot;\n&quot;); </span></span><br><span class="line">		</span><br><span class="line">		<span class="built_in">fclose</span>(fp);</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;是否继续录入？(y/n)\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; c;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">Search</span><span class="params">()</span></span>&#123;</span><br><span class="line">	<span class="keyword">char</span> c = <span class="string">&#x27;y&#x27;</span>;</span><br><span class="line">	<span class="keyword">int</span> flag = <span class="number">0</span>;</span><br><span class="line">	FILE* fp;</span><br><span class="line">	<span class="keyword">int</span> isSearch;</span><br><span class="line">	Student stu = &#123;<span class="number">0</span>&#125;;</span><br><span class="line">	<span class="keyword">while</span>(c == <span class="string">&#x27;y&#x27;</span>)&#123;</span><br><span class="line">		<span class="keyword">char</span> stu_info[<span class="number">50</span>], ins[<span class="number">50</span>] = &#123;<span class="number">0</span>&#125;;</span><br><span class="line">		<span class="keyword">char</span> file[<span class="number">50</span>] = <span class="string">&quot;C:\\Users\\Administrator\\Desktop\\&quot;</span>;</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;输入学生所在学院\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; ins;</span><br><span class="line">		</span><br><span class="line">		<span class="built_in">strcat</span>(file ,ins);</span><br><span class="line">		<span class="built_in">strcat</span>(file, <span class="string">&quot;.txt&quot;</span>);</span><br><span class="line">		</span><br><span class="line">		fp = <span class="built_in">fopen</span>(file, <span class="string">&quot;r&quot;</span>);</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入查找方式：1/学号,2/姓名\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; flag;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;待查找的信息：&quot;</span> &lt;&lt;endl;</span><br><span class="line">		cin &gt;&gt; stu_info;</span><br><span class="line">		</span><br><span class="line">		isSearch = <span class="number">0</span>;</span><br><span class="line">		<span class="keyword">while</span>(<span class="built_in">fread</span>(&amp;stu, <span class="built_in"><span class="keyword">sizeof</span></span>(Student), <span class="number">1</span>, fp) == <span class="number">1</span> )&#123;</span><br><span class="line">			<span class="comment">//当读到数据时</span></span><br><span class="line">			<span class="keyword">if</span>(flag == <span class="number">1</span>)&#123;</span><br><span class="line">				<span class="keyword">if</span>(!<span class="built_in">strcmp</span>(stu.stu_num, stu_info))&#123;</span><br><span class="line">					cout &lt;&lt; <span class="string">&quot;找到了，数据为：\n&quot;</span>;</span><br><span class="line">					<span class="built_in">Print</span>(stu);</span><br><span class="line">					isSearch = <span class="number">1</span>;</span><br><span class="line">					<span class="keyword">break</span>;</span><br><span class="line">				&#125;</span><br><span class="line">				</span><br><span class="line">				<span class="keyword">if</span>(!<span class="built_in">strcmp</span>(stu.name, stu_info))&#123;</span><br><span class="line">					cout &lt;&lt; <span class="string">&quot;找到了，数据为：\n&quot;</span>;</span><br><span class="line">					<span class="built_in">Print</span>(stu);</span><br><span class="line">					isSearch = <span class="number">1</span>;</span><br><span class="line">					<span class="keyword">break</span>;</span><br><span class="line">				&#125;</span><br><span class="line">			&#125; </span><br><span class="line">			<span class="keyword">if</span>(isSearch == <span class="number">0</span>)&#123;</span><br><span class="line">				cout &lt;&lt; <span class="string">&quot;查无此人！&quot;</span> &lt;&lt;endl;</span><br><span class="line">			&#125;</span><br><span class="line">			<span class="built_in">fclose</span>(fp);</span><br><span class="line">			</span><br><span class="line">			cout &lt;&lt; <span class="string">&quot;是否继续查找(y/n)\n&quot;</span>;</span><br><span class="line">			cin &gt;&gt; c;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">&#125; </span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">Alter</span><span class="params">()</span></span>&#123;</span><br><span class="line">	FILE* fp;</span><br><span class="line">	<span class="keyword">int</span> isSearch;</span><br><span class="line">	<span class="keyword">int</span> pos, num;</span><br><span class="line">	<span class="keyword">int</span> i;</span><br><span class="line">	</span><br><span class="line">	<span class="keyword">char</span> c = <span class="string">&#x27;y&#x27;</span>;</span><br><span class="line">	<span class="keyword">while</span>(c == <span class="string">&#x27;y&#x27;</span>)&#123;</span><br><span class="line">		<span class="keyword">char</span> newfile[<span class="number">10000</span>] = <span class="string">&quot;C:\\Users\\Administrator\\Desktop\\&quot;</span>;</span><br><span class="line">		<span class="keyword">char</span> stu_info[<span class="number">50</span>], ins[<span class="number">50</span>], file[<span class="number">50</span>] = <span class="string">&quot;C:\\Users\\Administrator\\Desktop\\&quot;</span>;</span><br><span class="line">		Student all_stu[<span class="number">50</span>], goal_stu, stu=&#123;<span class="number">0</span>&#125;;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入学生所在学院\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; ins;</span><br><span class="line">		<span class="built_in">strcat</span>(file, ins);</span><br><span class="line">		<span class="built_in">strcat</span>(file, <span class="string">&quot;.txt&quot;</span>);</span><br><span class="line">		</span><br><span class="line">		fp = <span class="built_in">fopen</span>(file, <span class="string">&quot;r&quot;</span>);</span><br><span class="line">		cout &lt;&lt;<span class="string">&quot;输入学生学号:\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu_info;</span><br><span class="line">		</span><br><span class="line">		isSearch = <span class="number">0</span>;</span><br><span class="line">		pos = <span class="number">0</span>;</span><br><span class="line">		num = <span class="number">0</span>;</span><br><span class="line">		<span class="keyword">for</span>(pos=<span class="number">0</span>; <span class="built_in">fread</span>(&amp;stu, <span class="built_in"><span class="keyword">sizeof</span></span>(Student), <span class="number">1</span>, fp)==<span class="number">1</span>; pos++)&#123;</span><br><span class="line">			<span class="keyword">if</span>(!<span class="built_in">strcmp</span>(stu.stu_num, stu_info))&#123;</span><br><span class="line">				goal_stu = stu;</span><br><span class="line">				isSearch = <span class="number">1</span>;</span><br><span class="line">			&#125;<span class="keyword">else</span>&#123;</span><br><span class="line">				all_stu[num++] = stu;</span><br><span class="line">			&#125;		</span><br><span class="line">		&#125;</span><br><span class="line">		</span><br><span class="line">		<span class="keyword">if</span>(isSearch)&#123;</span><br><span class="line">			<span class="built_in">fclose</span>(fp);</span><br><span class="line">			fp = <span class="built_in">fopen</span>(file, <span class="string">&quot;w&quot;</span>);</span><br><span class="line">			<span class="keyword">for</span>(i =<span class="number">0</span>; i&lt;num; i++)&#123;</span><br><span class="line">				<span class="built_in">fwrite</span>(&amp;all_stu[i], <span class="built_in"><span class="keyword">sizeof</span></span>(Student), <span class="number">1</span>, fp);</span><br><span class="line">			&#125;</span><br><span class="line">			</span><br><span class="line">		<span class="built_in">fclose</span>(fp);</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入信息：\n\n&quot;</span>;</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入学号：\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.stu_num;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入姓名:\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.name;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入身份证号：\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.stu_id;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入学生类型:1/本, 2/硕, 3/博\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.stu_type;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入所在学院：\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.institute;</span><br><span class="line">		</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;请输入所在专业：\n&quot;</span>;</span><br><span class="line">		cin &gt;&gt; stu.major;</span><br><span class="line">		</span><br><span class="line">		<span class="built_in">strcat</span>(newfile, stu.institute);</span><br><span class="line">		<span class="built_in">strcat</span>(newfile, <span class="string">&quot;.txt&quot;</span>);</span><br><span class="line">		fp = <span class="built_in">fopen</span>(newfile, <span class="string">&quot;a&quot;</span>);</span><br><span class="line">		<span class="built_in">fwrite</span>(&amp;stu, <span class="built_in"><span class="keyword">sizeof</span></span>(Student), <span class="number">1</span>, fp); </span><br><span class="line">		&#125;<span class="keyword">else</span>&#123;</span><br><span class="line">		cout &lt;&lt; <span class="string">&quot;查无此人\n&quot;</span>;</span><br><span class="line">		&#125;</span><br><span class="line">	<span class="built_in">fclose</span>(fp);</span><br><span class="line">	cout &lt;&lt; file &lt;&lt;endl;</span><br><span class="line">	fp = <span class="built_in">fopen</span>(file, <span class="string">&quot;r&quot;</span>);</span><br><span class="line">	<span class="keyword">while</span>(<span class="built_in">fread</span>(&amp;stu, <span class="built_in"><span class="keyword">sizeof</span></span>(Student), <span class="number">1</span>, fp)==<span class="number">1</span>)&#123;</span><br><span class="line">		<span class="built_in">Print</span>(stu);</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="built_in">fclose</span>(fp);</span><br><span class="line">	cout &lt;&lt; <span class="string">&quot;是否继续修改y/n \n&quot;</span>;</span><br><span class="line">	cin &gt;&gt; c;</span><br><span class="line">	&#125; </span><br><span class="line">&#125; </span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">print_Sort</span><span class="params">()</span></span>&#123;</span><br><span class="line">	FILE* fp;</span><br><span class="line">	<span class="keyword">int</span> j, Min;</span><br><span class="line">	<span class="keyword">int</span> num = <span class="number">0</span>;</span><br><span class="line">	<span class="keyword">int</span> i;</span><br><span class="line">	Student all_stu[<span class="number">50</span>]=&#123;<span class="number">0</span>&#125;, stu=&#123;<span class="number">0</span>&#125;;</span><br><span class="line">	<span class="keyword">char</span> newfile[<span class="number">10000</span>] = <span class="string">&quot;C:\\Users\\Administrator\\Desktop\\sort_&quot;</span>;</span><br><span class="line">	<span class="keyword">char</span> ins[<span class="number">20</span>], file[<span class="number">50</span>] = <span class="string">&quot;C:\\Users\\Administrator\\Desktop\\&quot;</span>;</span><br><span class="line">	</span><br><span class="line">	cout &lt;&lt; <span class="string">&quot;请输入学院:\n&quot;</span>;</span><br><span class="line">	cin &gt;&gt; ins;</span><br><span class="line">	</span><br><span class="line">	<span class="built_in">strcat</span>(file, ins);</span><br><span class="line">	<span class="built_in">strcat</span>(file, <span class="string">&quot;.txt&quot;</span>);</span><br><span class="line">	</span><br><span class="line">	fp = <span class="built_in">fopen</span>(file, <span class="string">&quot;r&quot;</span>);</span><br><span class="line">	</span><br><span class="line">	<span class="keyword">while</span>(<span class="built_in">fread</span>(&amp;all_stu[num++], <span class="built_in"><span class="keyword">sizeof</span></span>(Student), <span class="number">1</span>, fp) == <span class="number">1</span>)&#123;</span><br><span class="line">		;		</span><br><span class="line">	&#125;</span><br><span class="line">	fclose;</span><br><span class="line">	</span><br><span class="line">	<span class="keyword">for</span>(i=<span class="number">0</span>; i&lt;num<span class="number">-1</span>; i++)&#123;</span><br><span class="line">		Min = i;</span><br><span class="line">		<span class="keyword">for</span>(j=i+<span class="number">1</span>; j&lt;num; j++)&#123;</span><br><span class="line">			<span class="keyword">if</span>(<span class="built_in">strcmp</span>(all_stu[Min].stu_num, all_stu[j].stu_num) &gt;<span class="number">0</span>)&#123;</span><br><span class="line">				Min = j;				</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">		</span><br><span class="line">		<span class="keyword">if</span>(Min != i)&#123;</span><br><span class="line">			Student temp = all_stu[i];</span><br><span class="line">			all_stu[i] = all_stu[Min];</span><br><span class="line">			all_stu[Min] = temp;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	<span class="built_in">strcat</span>(newfile, ins);</span><br><span class="line">	<span class="built_in">strcat</span>(newfile, <span class="string">&quot;.txt&quot;</span>); </span><br><span class="line">	fp = <span class="built_in">fopen</span>(newfile, <span class="string">&quot;w&quot;</span>);</span><br><span class="line">	<span class="keyword">for</span>(i=<span class="number">0</span>; i&lt;num; i++)&#123;</span><br><span class="line">		<span class="built_in">fwrite</span>(&amp;all_stu[i], <span class="built_in"><span class="keyword">sizeof</span></span>(Student), <span class="number">1</span>, fp);</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="built_in">fclose</span>(fp);</span><br><span class="line">	</span><br><span class="line">	fp = <span class="built_in">fopen</span>(newfile, <span class="string">&quot;r&quot;</span>);</span><br><span class="line">	<span class="keyword">while</span>(<span class="built_in">fread</span>(&amp;stu, <span class="built_in"><span class="keyword">sizeof</span></span>(Student), <span class="number">1</span>, fp)==<span class="number">1</span>)&#123;</span><br><span class="line">		<span class="built_in">Print</span>(stu);</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	<span class="built_in">fclose</span>(fp); </span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">passwordVerify</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">	<span class="keyword">char</span> password[<span class="number">20</span>]=&#123;<span class="number">0</span>&#125;;</span><br><span class="line">	    <span class="keyword">int</span> i=<span class="number">5</span>;</span><br><span class="line">	    <span class="built_in">printf</span>(<span class="string">&quot;\n\n&quot;</span>);</span><br><span class="line">	    <span class="built_in">printf</span>(<span class="string">&quot;====================欢迎使用学生返校信息管理系统====================\n\n&quot;</span>);</span><br><span class="line">	  </span><br><span class="line">	    <span class="keyword">while</span>(i&gt;<span class="number">0</span>)&#123;</span><br><span class="line">	    <span class="built_in">printf</span>(<span class="string">&quot;请输入登录密码：&quot;</span>);</span><br><span class="line">	    <span class="built_in">scanf</span>(<span class="string">&quot;%s&quot;</span>,&amp;password);</span><br><span class="line">	        <span class="keyword">if</span>(<span class="built_in">strcmp</span>(password,<span class="string">&quot;123456&quot;</span>)!=<span class="number">0</span>)&#123;</span><br><span class="line">	            --i;</span><br><span class="line">	            <span class="built_in">printf</span>(<span class="string">&quot;密码输入错误，请重新输入，您还有%d次机会\n&quot;</span>,i);</span><br><span class="line">	        &#125;</span><br><span class="line">	        <span class="keyword">else</span>&#123;</span><br><span class="line">	            <span class="built_in">printf</span>(<span class="string">&quot;密码输入正确！&quot;</span>);</span><br><span class="line">	            <span class="keyword">break</span>;&#125;</span><br><span class="line">	    <span class="keyword">if</span>(i==<span class="number">0</span>)&#123;</span><br><span class="line">	        <span class="built_in">exit</span>(<span class="number">0</span>);&#125;</span><br><span class="line">	    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">chooseMenu</span><span class="params">()</span></span>&#123;</span><br><span class="line">	<span class="keyword">int</span> flag;</span><br><span class="line">	<span class="keyword">char</span> c=<span class="string">&#x27;y&#x27;</span>;</span><br><span class="line">	<span class="keyword">while</span>(c==<span class="string">&#x27;y&#x27;</span>)&#123;</span><br><span class="line">	    <span class="built_in">printf</span>(<span class="string">&quot;请输入您需要的操作（按5请求帮助）： \n&quot;</span>);</span><br><span class="line">	    flag=<span class="number">0</span>;</span><br><span class="line">	    <span class="built_in">scanf</span>(<span class="string">&quot;%d&quot;</span>,&amp;flag);</span><br><span class="line">	    <span class="built_in">getchar</span>();</span><br><span class="line">	    <span class="keyword">if</span>(flag==<span class="number">1</span>)&#123;                    <span class="comment">//录入</span></span><br><span class="line">	        <span class="built_in">WriteStuInfo</span>();</span><br><span class="line">	    &#125;</span><br><span class="line">	    <span class="keyword">else</span> <span class="keyword">if</span>(flag==<span class="number">2</span>)&#123;               <span class="comment">//查找</span></span><br><span class="line">	        <span class="built_in">Search</span>();</span><br><span class="line">	    &#125;</span><br><span class="line">	    <span class="keyword">else</span> <span class="keyword">if</span>(flag==<span class="number">3</span>)&#123;               <span class="comment">//修改</span></span><br><span class="line">	        <span class="built_in">Alter</span>();</span><br><span class="line">	    &#125;</span><br><span class="line">	    <span class="keyword">else</span> <span class="keyword">if</span>(flag==<span class="number">4</span>)&#123;               <span class="comment">//排序</span></span><br><span class="line">	       <span class="built_in">print_Sort</span>();</span><br><span class="line">	    &#125;</span><br><span class="line">	    <span class="keyword">else</span> <span class="keyword">if</span>(flag==<span class="number">5</span>)&#123;               <span class="comment">//导航</span></span><br><span class="line">	        <span class="built_in">Instruction</span>();</span><br><span class="line">	    &#125;</span><br><span class="line">	    <span class="keyword">else</span> <span class="keyword">if</span>(flag==<span class="number">6</span>)&#123;               <span class="comment">//退出系统</span></span><br><span class="line">	        <span class="built_in">exit</span>(<span class="number">0</span>);</span><br><span class="line">	    &#125;</span><br><span class="line">	    <span class="keyword">else</span> &#123;</span><br><span class="line">	        <span class="built_in">printf</span>(<span class="string">&quot;输入有误！请重新输入！\n &quot;</span>);</span><br><span class="line">	        <span class="keyword">continue</span>;</span><br><span class="line">	    &#125;</span><br><span class="line">	    <span class="built_in">printf</span>(<span class="string">&quot;是否继续使用该系统（y/n）：&quot;</span>);</span><br><span class="line">	    <span class="built_in">scanf</span>(<span class="string">&quot;%c&quot;</span>,&amp;c);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;   <span class="built_in">passwordVerify</span>();</span><br><span class="line">    <span class="built_in">Instruction</span>();</span><br><span class="line">    <span class="built_in">system</span>(<span class="string">&quot;pause&quot;</span>);</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></div></figure></div><footer class="post-footer"><div class="post-ending ending"><div class="ending__text">------ 本文结束，感谢您的阅读 ------</div></div><div class="post-copyright copyright"><div class="copyright-author"><span class="copyright-author__name">本文作者: </span><span class="copyright-author__value"><a href="https://bruce-jj.gitee.io/blog">何水浪</a></span></div><div class="copyright-link"><span class="copyright-link__name">本文链接: </span><span class="copyright-link__value"><a href="https://bruce-jj.gitee.io/blog/2021/03/19/C-%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/">https://bruce-jj.gitee.io/blog/2021/03/19/C-%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/</a></span></div><div class="copyright-notice"><span class="copyright-notice__name">版权声明: </span><span class="copyright-notice__value">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en" rel="external nofollow" target="_blank">BY-NC-SA</a> 许可协议。转载请注明出处！</span></div></div><div class="post-tags"><span class="post-tags-item"><span class="post-tags-item__icon"><i class="fas fa-tag"></i></span><a class="post-tags-item__link" href="https://bruce-jj.gitee.io/blog/tags/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/">编程语言</a></span></div><nav class="post-paginator paginator"><div class="paginator-prev"><a class="paginator-prev__link" href="/blog/2021/03/26/xxx/"><span class="paginator-prev__icon"><i class="fas fa-angle-left"></i></span><span class="paginator-prev__text">复试代码（仅供参考）</span></a></div><div class="paginator-next"><a class="paginator-next__link" href="/blog/2021/03/17/C-%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E5%9F%BA%E7%A1%80/"><span class="paginator-prev__text">C++面向对象基础</span><span class="paginator-next__icon"><i class="fas fa-angle-right"></i></span></a></div></nav></footer></div></div><div class="comments" id="comments"><div id="valine-container"></div></div></div><div class="sidebar-wrap" id="sidebar-wrap"><aside class="sidebar" id="sidebar"><div class="sidebar-nav"><span class="sidebar-nav-toc current">文章目录</span><span class="sidebar-nav-ov">站点概览</span></div><section class="sidebar-toc"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%BA%90%E4%BB%A3%E7%A0%81"><span class="toc-number">1.</span> <span class="toc-text">
          源代码</span></a></li></ol></section><!-- ov = overview--><section class="sidebar-ov hide"><div class="sidebar-ov-author"><div class="sidebar-ov-author__avatar"><img class="sidebar-ov-author__avatar_img" src="/blog/images/avatar.jpg" alt="avatar"></div><p class="sidebar-ov-author__text">C'est la vie</p></div><div class="sidebar-ov-state"><a class="sidebar-ov-state-item sidebar-ov-state-item--posts" href="/blog/archives/"><div class="sidebar-ov-state-item__count">48</div><div class="sidebar-ov-state-item__name">归档</div></a><a class="sidebar-ov-state-item sidebar-ov-state-item--categories" href="/blog/categories/"><div class="sidebar-ov-state-item__count">19</div><div class="sidebar-ov-state-item__name">分类</div></a><a class="sidebar-ov-state-item sidebar-ov-state-item--tags" href="/blog/tags/"><div class="sidebar-ov-state-item__count">20</div><div class="sidebar-ov-state-item__name">标签</div></a></div><div class="sidebar-ov-cc"><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en" target="_blank" rel="noopener" data-popover="知识共享许可协议" data-popover-pos="up"><img src="/blog/images/cc-by-nc-sa.svg"></a></div></section><div class="sidebar-reading"><div class="sidebar-reading-info"><span class="sidebar-reading-info__text">你已阅读了 </span><span class="sidebar-reading-info__num">0</span><span class="sidebar-reading-info__perc">%</span></div><div class="sidebar-reading-line"></div></div></aside></div><div class="clearfix"></div></div></main><footer class="footer" id="footer"><div class="footer-inner"><div><span>Copyright © 2021</span><span class="footer__icon"><i class="fas fa-heart"></i></span><span>何水浪</span></div><div><span>由 <a href="http://hexo.io/" title="Hexo" target="_blank" rel="noopener">Hexo</a> 强力驱动</span><span> v5.4.0</span><span class="footer__devider">|</span><span>主题 - <a href="https://github.com/liuyib/hexo-theme-stun/" title="Stun" target="_blank" rel="noopener">Stun</a></span><span> v2.6.2</span></div></div></footer><div class="loading-bar" id="loading-bar"><div class="loading-bar__progress"></div></div><div class="back2top" id="back2top"><span class="back2top__icon"><i class="fas fa-rocket"></i></span></div></div><div class="search-mask"></div><div class="search-popup"><span class="search-close"></span><div class="search-input"><input placeholder="搜索文章（支持多关键词，请用空格分隔）"></div><div class="search-results"></div></div><script src="https://cdn.jsdelivr.net/npm/jquery@v3.4.1/dist/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.2/velocity.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.2/velocity.ui.min.js"></script><script>function initSearch() {
  var isXML = true;
  var search_path = 'search.json';

  if (!search_path) {
    search_path = 'search.xml';
  } else if (/json$/i.test(search_path)) {
    isXML = false;
  }

  var path = '/blog/' + search_path;
  $.ajax({
    url: path,
    dataType: isXML ? 'xml' : 'json',
    async: true,
    success: function (res) {
      var datas = isXML ? $('entry', res).map(function () {
        // 将 XML 转为 JSON
        return {
          title: $('title', this).text(),
          content: $('content', this).text(),
          url: $('url', this).text()
        };
      }).get() : res;
      var $input = $('.search-input input');
      var $result = $('.search-results');
      // 搜索对象（标题、内容）的权重，影响显示顺序
      var WEIGHT = { title: 100, content: 1 };
      var searchPost = function () {
        var searchText = $input.val().toLowerCase().trim();
        // 根据空白字符分隔关键字
        var keywords = searchText.split(/[\s]+/);
        // 搜索结果
        var matchPosts = [];

        // 有多个关键字时，将原文字整个保存下来
        if (keywords.length > 1) {
          keywords.push(searchText);
        }
        // 防止未输入字符时搜索
        if (searchText.length > 0) {
          datas.forEach(function (data) {
            var isMatch  = false;
            // 没有标题的文章使用预设的 i18n 变量代替
            var title = (data.title && data.title.trim()) || '[ 文章无标题 ]';
            var titleLower = title && title.toLowerCase();
            // 删除 HTML 标签 和 所有空白字符
            var content = data.content && data.content.replace(/<[^>]+>/g, '');
            var contentLower = content && content.toLowerCase();
            // 删除重复的 /
            var postURL = data.url && decodeURI(data.url).replace(/\/{2,}/g, '/');
            // 标题中匹配到的关键词
            var titleHitSlice = [];
            // 内容中匹配到的关键词
            var contentHitSlice = [];

            keywords.forEach(function (keyword) {
              /**
              * 获取匹配的关键词的索引
              * @param {String} keyword 要匹配的关键字
              * @param {String} text 原文字
              * @param {Boolean} caseSensitive 是否区分大小写
              * @param {Number} weight 匹配对象的权重。权重大的优先显示
              * @return {Array}
              */
              function getIndexByword (word, text, caseSensitive, weight) {
                if (!word || !text) {
                  return [];
                };

                var startIndex = 0; // 每次匹配的开始索引
                var index = -1;     // 匹配到的索引值
                var result = [];    // 匹配结果

                if (!caseSensitive) {
                  word = word.toLowerCase();
                  text = text.toLowerCase();
                }

                while((index = text.indexOf(word, startIndex)) !== -1) {
                  var hasMatch = false;
                  // 索引位置相同的关键词，保留长度较长的
                  titleHitSlice.forEach(function (hit) {
                    if (hit.index === index && hit.word.length < word.length) {
                      hit.word = word;
                      hasMatch = true;
                    }
                  });
                  startIndex = index + word.length;
                  !hasMatch && result.push({ index: index, word: word, weight: weight });
                }
                return result;
              }
              titleHitSlice = titleHitSlice.concat(getIndexByword(keyword, titleLower, false, WEIGHT.title));
              contentHitSlice = contentHitSlice.concat(getIndexByword(keyword, contentLower, false, WEIGHT.content));
            });

            var hitTitle = titleHitSlice.length;
            var hitContent = contentHitSlice.length;

            if (hitTitle > 0 || hitContent > 0) {
              isMatch = true;
            }
            if (isMatch) {
              ;[titleHitSlice, contentHitSlice].forEach(function (hit) {
                // 按照匹配文字的索引的递增顺序排序
                hit.sort(function (left, right) {
                  return left.index - right.index;
                });
              });
              /**
              * 给文本中匹配到的关键词添加标记，从而进行高亮显示
              * @param {String} text 原文本
              * @param {Array} hitSlice 匹配项的索引信息
              * @param {Number} start 开始索引
              * @param {Number} end 结束索引
              * @return {String}
              */
              function highlightKeyword (text, hitSlice, start, end) {
                if (!text || !hitSlice || !hitSlice.length) {
                  return;
                }

                var result = '';
                var startIndex = start;
                var endIndex = end;
                hitSlice.forEach(function (hit) {
                  if (hit.index < startIndex) {
                    return;
                  }

                  var hitWordEnd = hit.index + hit.word.length;
                  result += text.slice(startIndex, hit.index);
                  result += '<b>' + text.slice(hit.index, hitWordEnd) + '</b>';
                  startIndex = hitWordEnd;
                });
                result += text.slice(startIndex, endIndex);
                return result;
              }

              var postData = {};
              // 文章总的搜索权重
              var postWeight = titleHitSlice.length * WEIGHT.title + contentHitSlice.length * WEIGHT.content;
              // 标记匹配关键词后的标题
              var postTitle = highlightKeyword(title, titleHitSlice, 0, title.length) || title;
              // 标记匹配关键词后的内容
              var postContent;
              // 显示内容的长度
              var SHOW_WORD_LENGTH = 200;
              // 命中关键词前的字符显示长度
              var SHOW_WORD_FRONT_LENGTH = 20;
              var SHOW_WORD_END_LENGTH = SHOW_WORD_LENGTH - SHOW_WORD_FRONT_LENGTH;

              // 截取匹配的第一个字符，前后共 200 个字符来显示
              if (contentHitSlice.length > 0) {
                var firstIndex = contentHitSlice[0].index;
                var start = firstIndex > SHOW_WORD_FRONT_LENGTH ? firstIndex - SHOW_WORD_FRONT_LENGTH : 0;
                var end = firstIndex + SHOW_WORD_END_LENGTH;
                postContent = highlightKeyword(content, contentHitSlice, start, end);
              } else { // 未匹配到内容，直接截取前 200 个字符来显示
                postContent = content.slice(0, SHOW_WORD_LENGTH);
              }
              postData.title = postTitle;
              postData.content = postContent;
              postData.url = postURL;
              postData.weight = postWeight;
              matchPosts.push(postData);
            }
          });
        }

        var resultInnerHtml = '';
        if (matchPosts.length) {
          // 按权重递增的顺序排序，使权重大的优先显示
          matchPosts.sort(function (left, right) {
            return right.weight - left.weight;
          });
          resultInnerHtml += '<ul>';
          matchPosts.forEach(function (post) {
            resultInnerHtml += '<li><a class="search-results-title" href="' + post.url + '">';
            resultInnerHtml += post.title;
            resultInnerHtml += '</a><div class="search-results-content">';
            resultInnerHtml += post.content;
            resultInnerHtml += '</div></li>';
          });
          resultInnerHtml += '</ul>';
        } else {
          resultInnerHtml += '<div class="search-results-none"><i class="far fa-meh"></i></div>';
        }
        $result.html(resultInnerHtml);
      };
      $input.on('input', searchPost);
      $input.on('keyup', function (e) {
        if (e.keyCode === Stun.utils.codeToKeyCode('Enter')) {
          searchPost();
        }
      });
    }
  });
}

function closeSearch () {
  $('body').css({ overflow: 'auto' });
  $('.search-popup').css({ display: 'none' });
  $('.search-mask').css({ display: 'none' });
}

window.addEventListener('DOMContentLoaded', function () {
  Stun.utils.pjaxReloadLocalSearch = function () {
    $('.header-nav-search').on('click', function (e) {
      e.stopPropagation();
      $('body').css('overflow', 'hidden');
      $('.search-popup')
        .velocity('stop')
        .velocity('transition.expandIn', {
          duration: 300,
          complete: function () {
            $('.search-popup input').focus();
          }
        });
      $('.search-mask')
        .velocity('stop')
        .velocity('transition.fadeIn', {
          duration: 300
        });

      initSearch();
    });
    $('.search-mask, .search-close').on('click', function () {
      closeSearch();
    });
    $(document).on('keydown', function (e) {
      // Escape <=> 27
      if (e.keyCode === Stun.utils.codeToKeyCode('Escape')) {
        closeSearch();
      }
    });
  };

  Stun.utils.pjaxReloadLocalSearch();
}, false);

function safeOpenUrl(url) {
  var newTab = window.open();
  newTab.opener = null;
  newTab.location = url;
}

function extSearch(engine) {
  var engines = {
    google: 'https://www.google.com/search?q=',
    bing: 'https://cn.bing.com/search?q=',
    baidu: 'https://www.baidu.com/s?ie=UTF-8&wd=',
  };
  var host = window.location.host;
  var query = $('.search-input input').val().toLowerCase().trim();
  var uri = engines[engine] + query + ' site:' + host;

  if (query) {
    safeOpenUrl(uri);
  } else {
    Stun.utils.popAlert('warning', '请输入字符');
  }
}

var assistSearchList = window.CONFIG.assistSearch;

if (Array.isArray(assistSearchList)) {
  assistSearchList.forEach(function (name) {
    document.querySelector('.search-btns-item--' + name).addEventListener('click', function () {
      extSearch(name);
    }, false);
  });
}</script><script src="https://cdn.jsdelivr.net/npm/leancloud-storage@latest/dist/av-min.js"></script><script src="https://cdn.jsdelivr.net/npm/valine@latest/dist/Valine.min.js"></script><script>function loadValine () {
  var GUEST_INFO = ['nick', 'mail', 'link'];
  var guest_info = 'nick';

  guest_info = guest_info.split(',').filter(function(item) {
    return GUEST_INFO.indexOf(item) > -1;
  });
  new Valine({
    el: '#valine-container',
    appId: 'fJ4fFnieffDVKy4Jkn16aHdO-gzGzoHsz',
    appKey: 'qfVo2CUC2pJ3udFzLFnd0GBM',
    notify: true,
    verify: true,
    placeholder: '说点啥再走呗~爱你',
    avatar: 'mp',
    meta: guest_info,
    pageSize: '10' || 10,
    visitor: false,
    recordIP: false,
    lang: '' || 'zh-cn',
    path: window.location.pathname
  });
}

if (false) {
  loadValine();
} else {
  window.addEventListener('DOMContentLoaded', loadValine, false);
}</script><script src="/blog/js/utils.js?v=2.6.2"></script><script src="/blog/js/stun-boot.js?v=2.6.2"></script><script src="/blog/js/scroll.js?v=2.6.2"></script><script src="/blog/js/header.js?v=2.6.2"></script><script src="/blog/js/sidebar.js?v=2.6.2"></script><script type="application/json" src="/blog/search.json"></script></body></html>